package com.audaque.springboot.foshanupload.web.raspcloud.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;
import com.audaque.springboot.foshanupload.web.raspcloud.entity.*;
import com.audaque.springboot.foshanupload.web.raspcloud.req.*;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.metadata.IPage;

import org.springframework.http.HttpStatus;
import com.audaque.springboot.foshanupload.web.raspcloud.service.IUserGroupUserRelService;
import com.audaque.springboot.foshanupload.web.raspcloud.entity.UserGroupUserRel;
import org.springframework.beans.factory.annotation.Autowired;



import io.swagger.v3.oas.annotations.media.Schema;




import lombok.*;


/**
 * <p>
 * 后台用户组和用户关系表 前端控制器
 * </p>
 *
 * @author chinaben
 * @since 2025-06-25
 */
@RestController

@Api(value = "后台用户组和用户关系表 前端控制器")

@RequestMapping("/userGroupUserRel")
public class UserGroupUserRelController {


    @Autowired
    private IUserGroupUserRelService iUserGroupUserRelService;

    @PostMapping(value = "/page")
    @ApiOperation(value = "后台用户组和用户关系表 分页查询")
    public Page<UserGroupUserRel> page(@RequestBody UserGroupUserRelReq req) {
        QueryWrapper queryWrapper = new QueryWrapper(req);
        Page<UserGroupUserRel> page = iUserGroupUserRelService.page(new Page<>(req.getPage(), req.getRows()),queryWrapper);
        return page;
    }




    @PostMapping(value = "/list")
    @ApiOperation(value = "后台用户组和用户关系表 列表查询")
    public List<UserGroupUserRel> list(@RequestBody UserGroupUserRelReq req) {
        QueryWrapper queryWrapper = new QueryWrapper(req);
        List<UserGroupUserRel> list = iUserGroupUserRelService.list(queryWrapper);
        return list;
    }





    @GetMapping(value = "/{id}")
     @ApiOperation(value = "后台用户组和用户关系表 单体查询")
    public UserGroupUserRel getById(@PathVariable("id") String id) {
        UserGroupUserRel one=iUserGroupUserRelService.getById(id);
        return one;
    }

    @PostMapping(value = "/create")
     @ApiOperation(value = "后台用户组和用户关系表 创建")
    public void create(@RequestBody UserGroupUserRel params) {
        iUserGroupUserRelService.save(params);
    }

    @PostMapping(value = "/delete/{id}")
     @ApiOperation(value = "后台用户组和用户关系表 删除")
    public void delete(@PathVariable("id") String id) {
        iUserGroupUserRelService.removeById(id);
    }

    @PostMapping(value = "/update")
     @ApiOperation(value = "后台用户组和用户关系表 更新")
    public void update(@RequestBody UserGroupUserRel params) {
        iUserGroupUserRelService.updateById(params);
    }
}
